home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / m_to_r / rr65 / rrsqlint.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  18.1 KB  |  498 lines

  1. { Function prototypes and declarations for SQL edition }
  2. { Of R&R V6.5 }
  3.  
  4. { Author Chris Brooksbank (cbrooksbank@msn.com) }
  5. { Written : October 1995 }
  6.  
  7. unit RRSQLInt;
  8.  
  9. interface
  10.  
  11. uses WinTypes;
  12.  
  13.  
  14.  
  15. { SQL Specific functions follow }
  16.  
  17.  
  18.  
  19. { Data source for report }
  20. function  ChooseDataSource(hReport:Integer;DataSource:PChar;Size:Integer): Boolean;far;
  21.   { Interactive choosing by user }
  22. function  SetDataSource(hReport: Integer;DataSource: PChar): Boolean;far;
  23. function  GetDataSource(hReport: Integer;DataSource: PChar;SourceSize:Integer): Boolean;far;
  24.  
  25.  
  26. { Allow user to interactively select a table,database and datasource }
  27. function ChooseTable(hReport:Integer;Table:PChar;SizeofTable:Integer;
  28.                   DataSource:PChar;SizeOfDataSource:Integer;
  29.               DataBase:PChar;SizeOfDataBase:Integer): Boolean;far;
  30.  
  31.  
  32. { Get/set functions for join informations. Main table & related alias name.}
  33. function GetFirstJoinInfo(hReport:Integer;TableName:PChar;
  34.                       TableSize:Integer;Alias:PChar;
  35.               AliasSize:Integer): Boolean;far;
  36. function GetNextJoinInfo(hReport:Integer;TableName:PChar;
  37.                            TableSize:Integer;Alias:PChar;
  38.              AliasSize:Integer): Boolean;far;
  39. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  40. function setJoinInfo(hreport:Integer;TableName:PChar;
  41.                  AliasName:PChar;AliasNum:Integer): Boolean;far;
  42.  
  43. { Get/set functions for replaceable parts of SELECT,EXEC or DEFINE REPORTVIEW
  44.   statements. ( Those parts enclosed in <<>> e.g. :
  45.   Select <<'firstname','lastname'>> from students
  46.   where <<'firstname'<'lastname'>>}
  47. function GetFirstReplace(hReport:Integer;Replace:PChar;Size:Integer): Boolean;far;
  48. function GetNextReplace (hReport:Integer;Replace:PChar;Size:Integer): Boolean;far;
  49. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  50. function SetReplace(hReport:Integer;Replacement:PChar): Boolean;far;
  51.   { Replacement should be comma-separated list of parameters
  52.     enclosed in double angle brackets :
  53.     <<param1>>,<<param2>>,<<param3>>...<<paramn>>}
  54.  
  55. { Set username and password needed to connect to reports datasource }
  56. function setPassword(hReport:Integer;Password:PChar): Boolean;far;
  57. function setUserName(hReport:Integer;UserName:PChar): Boolean;far;
  58.  
  59. { Specify a where clause for insertion in the SQL statement of#
  60.   the Auto-SQL report specified by hReport . No effect on a user-SQL report }
  61. function SetWhere(hReport:Integer;Where:PChar): Boolean;far;
  62.  
  63.  
  64.  
  65.  
  66. { Generic functions follow }
  67.  
  68.  
  69.  
  70.  
  71. { ************* Initialisation and cleanup functions/ run report ******* }
  72. function InitRunTimeInstance: Boolean;far;
  73.   { You must call this function first. It initialises an instance of the
  74.     R&R runtime DLL }
  75. function EndRunTimeInstance: Boolean;far;
  76.   { Call this function to cleanup after you have finished using the R&R
  77.     runtime DLL }
  78. function EndReport(hReport: Integer): Boolean;far;
  79.   { Free resources allocated to a report. Always call after using a report. }
  80. function  ChooseReport(MyApp,LibName,RepName:PChar;Size: Integer): Integer;far;
  81.   { Given a report library and report name return a handle to this report.
  82.     Most functions need a hReport param. That is what this function returns.
  83.     If RepName is NIL interactively asks for report from menu }
  84. function  GetNewReportHandle(MyApp: PChar): Integer;far;
  85.   { Another way of getting a report handle. This is a handle to a empty
  86.     report information structure. Use ChooseReport in preference to this }
  87. function  execRuntime(hReport:Integer;Wait:Boolean;cmdShow: Integer;
  88.                       ECode: PInteger;PageCount: PLongInt;
  89.                       EMsg:Pchar;Emsgsizeof: Integer): Boolean;far;
  90.    { After getting a report handle and amending any settings call this
  91.      function to actually run the report
  92.      cmdShow can be sw_hide,sw_minimize,sw_restore,sw_show,sw_showmaximized,
  93.                     sw_showminimized,sw_showminnoactive,sw_showna,
  94.             sw_shownoactive,sw_shownormal
  95.             ie any Windows API ShowWindow
  96.      on Return Ecode value indicates (Error message in EMsg) :
  97.      Ecode=N Successful execution of report
  98.      Ecode=C User cancelled the report Emsg="Report canceled"
  99.      Ecode=J Report structure pointed to by hReport is incorrect/corrupt
  100.      Ecode=R Report began to execute but failed to complete. }
  101. { ********************************************************************** }
  102.  
  103.  
  104. { ********************************************************************** }
  105. { Getting information about R&R errors }
  106. function GetErrorInfo(Msg:PChar;MsgSize:Integer;ErrCode:PInteger): Boolean;far;
  107.   { Get error message and code returned by last DLL call }
  108.   { ErrCode can be :
  109.     C=Cancel. User cancelled a dialog box presented by the R&R DLL
  110.     D=Diagnostic. Misc. error such as out of memory
  111.     I=Iteration. No more values for requested getfirst or getnext function
  112.     J=Job Control. Problem with specified runtime control file
  113.     L=Library.Problem with report library being accessed
  114.     S=Syntax error.
  115.     V=Value. No value available for specified paramater.}
  116. function resetErrorInfo: Boolean;far;
  117.   { Clear out the last error message }
  118. { ********************************************************************** }
  119.  
  120.  
  121. { Which page to start printing at }
  122. function  GetBeginPage(hReport: Integer;BeginPage: Plongint): Boolean;far;
  123. function  SetBeginPage(hReport: Integer;lBeginPage: longint): Boolean;far;
  124.  
  125. { Which page to end printing at }
  126. function  GetEndPage(hReport:Integer;EndPage: Plongint): Boolean;far;
  127. function  SetEndPage(hReport: Integer;EndPage: LongInt): Boolean;far;
  128.  
  129. { How many copies of report to print }
  130. function  GetCopies(hReport: Integer;Copies: PInteger): Boolean;far;
  131. function  SetCopies(hReport: Integer;Copies: Integer): Boolean;far;
  132.  
  133. { Should R&R display errors on the screen ? }
  134. function SetDisplayErrors(hReport:Integer;DispErr: Boolean): Boolean;far;
  135. function GetDisplayErrors(hReport:Integer;DispErr: Pbool): Boolean;far;
  136.  
  137. { Should R&R display a status window as the report is being generated ? }
  138. function SetDisplayStatus(hReport:Integer;DispStatus: Boolean): Boolean;far;
  139. function GetDisplayStatus(hReport:Integer;DispStatus:PBool): Boolean;far;
  140.  
  141. { Export destination }
  142. { D=Display
  143.   F=File
  144.   P=Printer }
  145. function SetExportDest(hReport:Integer;Val: char ): Boolean;far;
  146. function GetExportDest(hReport:Integer;Val: PChar): Boolean;far;
  147.  
  148. { View/alter the filter the report will use }
  149. function setFilter(hReport:Integer;Filter: PChar): Boolean;far;
  150. function getFilter(hReport:Integer;Filter:Pchar;Size:Integer): Boolean;far;
  151.  
  152. { Which filter to use }
  153. { S=use filter saved with report
  154.   E=dont use any filter. Use entire recordset
  155.   O=Use filter specified with setfilter()
  156.   ?=Allow user to interactively design filter at runtime }
  157. function setFilterUsage(hReport:Integer;Val:Char): Boolean;far;
  158. function getFilterUsage(hReport:Integer;Val: PChar): Boolean;far;
  159.  
  160. { get/set the main table to be used in the report }
  161. function setMasterTableName(hReport:Integer;FileName:PChar): Boolean;far;
  162. function getMasterTableName(hReport:Integer;Filename: PChar;Size: Integer): Boolean;far;
  163.  
  164. { get/set the ASCII memo file to use in the report }
  165. function setMemoName(hReport:Integer;Path:Pchar): Boolean;far;
  166. function getMemoName(hReport:Integer;Path:PChar;Size:Integer): Boolean;far;
  167.  
  168. { get/set the Report output destination }
  169. { D=Display
  170.   A/T=Text File - set by setOutputFile
  171.   P=Printer
  172.   W=Worksheet File
  173.   X=XBASE file
  174.   ?=Interactive at runtime }
  175. function setOutputDest(hReport:Integer;Dest:Char): Boolean;far;
  176. function getOutputDest(hReport:Integer;Dest:Pchar): Boolean;far;
  177.  
  178. { Filename to output report to }
  179. function setOutputFile(hReport:Integer;Name:Pchar): Boolean;far;
  180. function getOutputFile(hReport:Integer;Name:PChar;Size: Integer): Boolean;far;
  181.  
  182. { Allow user to interactively select the printer to use }
  183. { can later pass selected name to setPrinter }
  184. function ChoosePrinter(hReport:Integer;Printer:PChar;SizePrinter:Integer;
  185.                    PortName:PChar;SizePort:Integer): Boolean;far;
  186.  
  187. { Get/set printer name associated with the report }
  188. function getPrinter(hReport:Integer;PrinterName: PChar;Size: Integer): Boolean;far;
  189. function setPrinter(hReport:Integer;PrinterName: PChar): Boolean;far;
  190.  
  191. { Set the parent window of the preview window by passing the window handle }
  192. function SetWinParentHandle(hReport:Integer;hParent:Integer): Boolean;far;
  193.  
  194. { Replace the default data directory specified in RSW.INI }
  195. function SetDataDir(hReport:Integer;Dir:PChar): Boolean;far;
  196.  
  197. { Get/set functions for group fields }
  198. function GetFirstGroupField(hReport:Integer;Name:PChar;Size:Integer): Boolean;far;
  199. function GetNextGroupField(hReport:Integer;Name:PChar;Size:Integer):  Boolean;far;
  200. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  201. function SetGroupField(hReport:Integer;Name:Pchar;GroupNum:Integer): Boolean;far;
  202. { Need to setgroupfields 1..last one to modify }
  203.  
  204. { Replace the default image directory as stored in RSW.INI }
  205. function SetImageDir(hReport:Integer;Dir:PChar): Boolean;far;
  206.  
  207. { Get/Set printer port }
  208. function GetPrinterPort(hReport:Integer;PortName:PChar;Size:Integer): Boolean;far;
  209. function SetPrinterPort(hReport:Integer;Port:PChar): Boolean;far;
  210.  
  211. { R=User prompted to select a report from current report library
  212.   ?=User prompted to pick a succession of reports }
  213. function GetReportPick(hReport:Integer;Pickflag:PChar): Boolean;far;
  214. function SetReportPick(hReport:Integer;Pickflag:Char): Boolean;far;
  215.  
  216. { Functions to get/set sort fields }
  217. function GetFirstSortField(hReport:Integer;Name:PChar;Size:Integer): Boolean;far;
  218. function GetNextSortField(hReport:Integer;Name:PChar;Size:Integer): Boolean;far;
  219. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  220. function SetSortField(hReport:Integer;Name:PChar;SortNum:Integer): Boolean;far;
  221.  
  222. { Get field names available to report }
  223. function GetFirstFieldName(hReport:Integer;FieldName:PChar;FnSize:Integer): Boolean;far;
  224. function GetNextFieldName(hReport:Integer;FieldName:PChar;Fnsize:Integer): Boolean;far;
  225. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  226.  
  227. { Get/set user paramaters }
  228. function GetFirstUserParam(hReport:Integer;PName:PChar;PNameSize:Integer;
  229.                        PValue:PChar;PValueSize:Integer): Boolean;far;
  230. function GetNextUserParam(hReport:Integer;PName:PChar;PNameSize:Integer;
  231.                        PValue:PChar;PValueSize:Integer): Boolean;far;
  232. { GetErrorInfo() returns 'I' in 3rd param when no more in list }
  233. function SetUserParam(hReport:Integer;Name:PChar;Value:PChar): Boolean;far;
  234. { To get R&R to ask in a dialog 'Enter Your Name :' then pass a value of
  235.   "?Enter your name:"}
  236.  
  237. { Should user be allowed to abort report when R&R is generating it by
  238.   clicking on a cancel button ? }
  239. function GetPreventEscape(hReport:Integer;Value:PBool): Boolean;far;
  240. function SetPreventEscape(hReport:Integer;Value:Boolean): Boolean;far;
  241.  
  242. { Get/set report library name and directory }
  243. function GetLibrary(hReport:Integer;LibName:PChar;LibNameSize:Integer): Boolean;far;
  244. function setLibrary(hreport:Integer;LibName:PChar): Boolean;far;
  245. function setLibraryDir(hReport:Integer;DirName:PChar): Boolean;far;
  246.  
  247.  
  248. { Should user be offered a test pattern before real report is printed ? }
  249. function getTestPattern(hReport:Integer;Value:PBool): Boolean;far;
  250. function setTestPattern(hReport:Integer;Value:Boolean): Boolean;far;
  251.  
  252. { Read/write all configurations for current report to a ASCII file }
  253. function getRunTimeRecord(AppName:PChar;Filename:PChar): Integer;far;
  254. function writeRunTimeRecord(hReport:Integer;FileName:PChar): Boolean;far;
  255.  
  256. { Should status file be updated after every page or just at report end ? }
  257. { status file only applicable when execRuntime is passed Wait of nonzero}
  258. function getStatusEveryPage(hReport:Integer;Value:PBool):Boolean;far;
  259. function setStatusEveryPage(hReport:Integer;Value:Boolean):Boolean;far;
  260. function setStatusFileName(hReport:Integer;FileName:PChar): Boolean;far;
  261.  
  262. { Suppress title and summary areas for empty reports ? }
  263. function setSuppressTitle(hReport:Integer;Value:Boolean): Boolean;far;
  264.  
  265. { Get/set caption for runtime windows displayed by R&R runtime }
  266. function setWinTitle(hReport:Integer;Title:PChar): Boolean;far;
  267. function getWinTitle(hReport:Integer;Title:Pchar;Size:Integer): Boolean;far;
  268.  
  269. { Style of print-preview window
  270.   0=No Border
  271.   1=Fixed size & single line border
  272.   2=User can change size of preview window
  273.   3=Fixed size and double line border }
  274. function setWinBorderStyle(hReport:Integer;Style:Integer): Boolean;far;
  275.  
  276. { Should preview window have a control menu ? }
  277. function setWinControlBox(hReport:Integer;ControlBox:Boolean): Boolean;far;
  278.  
  279. { Get/set dimensions of report preview window }
  280. function setWinTop(hReport,WinTop:Integer): Boolean;far;
  281. function setWinLeft(hReport,Left:Integer): Boolean;far;
  282. function setWinWidth(hReport,WinWidth:Integer): Boolean;far;
  283. function setWinHeight(hReport,Height:Integer): Boolean;far;
  284.  
  285. { Allow minimize and maximise of preview window ? }
  286. function setWinMaxButton(hReport:Integer;AllowButton:Boolean): Boolean;far;
  287. function setWinMinButton(hReport:Integer;AllowButton:Boolean): Boolean;far;
  288.  
  289. { New to R&R V6.5 GetFilteredField Names }
  290. { Fieldnames available for the report suitable for use in sort/groups }
  291. { filterid code : 1 sortfield, 2 groupfield } 
  292. function GetFirstFilteredFieldName(hReport:Integer;FieldName:PChar;
  293.                           FieldNameSize:Integer;filterID:Integer):Boolean;far;
  294. function GetNextFilteredFieldName(hReport:Integer;FieldName:PChar;
  295.                           FieldNameSize:Integer;filterID:Integer):Boolean;far;
  296.  
  297.  
  298. implementation
  299.  
  300. { Tell Delphi that all the functions are stored in RSREPORT.DLL }
  301.  
  302.  
  303.  
  304. { SQL Specific Functions }
  305.  
  306.  
  307.  
  308. function ChooseDataSource;
  309.   external 'RSREPORT';
  310. function SetDataSource;
  311.   external 'RSREPORT';
  312. function GetDataSource;
  313.   external 'RSREPORT';
  314. function ChooseTable;
  315.   external 'RSREPORT';
  316. function GetFirstJoinInfo;
  317.   external 'RSREPORT';
  318. function GetNextJoinInfo;
  319.   external 'RSREPORT';
  320. function setJoinInfo;
  321.   external 'RSREPORT';
  322. function GetFirstReplace;
  323.   external 'RSREPORT';
  324. function GetNextReplace;
  325.   external 'RSREPORT';
  326. function SetReplace;
  327.   external 'RSREPORT';
  328. function setPassword;
  329.   external 'RSREPORT';
  330. function setUserName;
  331.   external 'RSREPORT';
  332. function SetWhere;
  333.   external 'RSREPORT';
  334. function GetFirstFilteredFieldName;
  335.   external 'RSREPORT';
  336. function GetNextFilteredFieldName;
  337.   external 'RSRPORT';
  338.  
  339.  
  340. { Generic Functions Follow }
  341.  
  342.  
  343.  
  344. function initRunTimeInstance;
  345.   external 'RSREPORT';
  346. function endRunTimeInstance;
  347.   external 'RSREPORT';
  348. function endReport;
  349.   external 'RSREPORT';
  350. function chooseReport;
  351.   external 'RSREPORT';
  352. function GetNewReportHandle;
  353.   external 'RSREPORT';
  354. function execRunTime;
  355.   external 'RSREPORT';
  356. function GetErrorInfo;
  357.   external 'RSREPORT';
  358. function ResetErrorInfo;
  359.   external 'RSREPORT';
  360. function GetBeginPage;
  361.   external 'RSREPORT';
  362. function SetBeginPage;
  363.   external 'RSREPORT';
  364. function GetEndPage;
  365.   external 'RSREPORT';
  366. function SetEndPage;
  367.   external 'RSREPORT';
  368. function GetCopies;
  369.   external 'RSREPORT';
  370. function SetCopies;
  371.   external 'RSREPORT';
  372. function SetDisplayErrors;
  373.   external 'RSREPORT';
  374. function GetDisplayErrors;
  375.   external 'RSREPORT';
  376. function SetDisplayStatus;
  377.   external 'RSREPORT';
  378. function GetDisplayStatus;
  379.   external 'RSREPORT';
  380. function SetExportDest;
  381.   external 'RSREPORT';
  382. function GetExportDest;
  383.   external 'RSREPORT';
  384. function setFilter;
  385.   external 'RSREPORT';
  386. function getFilter;
  387.   external 'RSREPORT';
  388. function setFilterUsage;
  389.   external 'RSREPORT';
  390. function getFilterUsage;
  391.   external 'RSREPORT';
  392. function setMasterTableName;
  393.   external 'RSREPORT';
  394. function getMasterTableName;
  395.   external 'RSREPORT';
  396. function setMemoName;
  397.   external 'RSREPORT';
  398. function getMemoName;
  399.   external 'RSREPORT';
  400. function setOutputDest;
  401.   external 'RSREPORT';
  402. function getOutputDest;
  403.   external 'RSREPORT';
  404. function setOutputFile;
  405.   external 'RSREPORT';
  406. function getOutputFile;
  407.   external 'RSREPORT';
  408. function ChoosePrinter;
  409.   external 'RSREPORT';
  410. function getPrinter;
  411.   external 'RSREPORT';
  412. function setPrinter;
  413.   external 'RSREPORT';
  414. function SetWinParentHandle;
  415.   external 'RSREPORT';
  416. function SetDataDir;
  417.   external 'RSREPORT';
  418. function getFirstGroupField;
  419.   external 'RSREPORT';
  420. function getNextGroupField;
  421.   external 'RSREPORT';
  422. function SetGroupField;
  423.   external 'RSREPORT';
  424. function SetImageDir;
  425.   external 'RSREPORT';
  426. function GetPrinterPort;
  427.   external 'RSREPORT';
  428. function SetPrinterPort;
  429.   external 'RSREPORT';
  430. function GetReportPick;
  431.   external 'RSREPORT';
  432. function SetReportPick;
  433.   external 'RSREPORT';
  434. function GetFirstSortField;
  435.   external 'RSREPORT';
  436. function GetNextSortField;
  437.   external 'RSREPORT';
  438. function SetSortField;
  439.   external 'RSREPORT';
  440. function GetFirstFieldName;
  441.   external 'RSREPORT';
  442. function GetNextFieldName;
  443.   external 'RSREPORT';     
  444. function GetFirstUserParam;
  445.   external 'RSREPORT';
  446. function GetNextUserParam;
  447.   external 'RSREPORT';
  448. function SetUserParam;
  449.   external 'RSREPORT';
  450. function GetPreventEscape;
  451.   external 'RSREPORT';
  452. function SetPreventEscape;
  453.   external 'RSREPORT';
  454. function GetLibrary;
  455.   external 'RSREPORT';
  456. function setLibrary;
  457.   external 'RSREPORT';
  458. function setLibraryDir;
  459.   external 'RSREPORT';
  460. function getTestPattern;
  461.   external 'RSREPORT';
  462. function setTestPattern;
  463.   external 'RSREPORT';
  464. function getRunTimeRecord;
  465.   external 'RSREPORT';
  466. function writeRunTimeRecord;
  467.   external 'RSREPORT';
  468. function getStatusEveryPage;
  469.   external 'RSREPORT';
  470. function setStatusEveryPage;
  471.   external 'RSREPORT';
  472. function setStatusFileName;
  473.   external 'RSREPORT';
  474. function setSuppressTitle;
  475.   external 'RSREPORT';
  476. function setWinTitle;
  477.   external 'RSREPORT';
  478. function getWinTitle;
  479.   external 'RSREPORT';
  480. function setWinBorderStyle;
  481.   external 'RSREPORT';
  482. function setWinControlBox;
  483.   external 'RSREPORT';
  484. function setWinTop;
  485.   external 'RSREPORT';
  486. function setWinLeft;
  487.   external 'RSREPORT';
  488. function setWinWidth;
  489.   external 'RSREPORT';
  490. function setWinHeight;
  491.   external 'RSREPORT';
  492. function setWinMaxButton;
  493.   external 'RSREPORT';
  494. function setWinMinButton;
  495.   external 'RSREPORT';
  496.  
  497. end.
  498.